package com.sr.controller.api;

import com.sr.constant.Constant;
import com.sr.controller.BaseController;
import com.sr.ibase.IBaseService;
import com.sr.pojo.WNavBar;
import com.sr.service.INavBarService;
import com.sr.util.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author xiaochi
 * @date 2022/4/30 14:09
 * @desc NavBarControllerApi
 */
@Api(tags = "导航模块")
@RestController
@RequestMapping(Constant.Api.WEB_PREFIX+"/navabr")
@RequiredArgsConstructor(onConstructor = @__)
public class NavBarControllerApi extends BaseController {

    private final INavBarService navBarService;

    /**
     * 查询所有导航
     * @return
     */
    @ApiOperation(value = "查询导航",notes = "查询导航")
    @GetMapping("/list/all")
    public R<List<WNavBar>> list(){
        IBaseService.Criteria<WNavBar> criteria = navBarService.createCriteria(WNavBar.class);
        criteria.andEqualTo(WNavBar::getIsDel,1);
        return R.ok(navBarService.findByWhere(criteria));
    }
}
